(function () {
    function WarnPrint(data) {

//        LODOP.PRINT_INIT(data.headDetail.fbillno);
console.log("=================sadf"+data.boxsCount.length);
        if(data.boxsCount.length>1){
         LODOP.PRINT_INIT();
            for(var i=0;i<data.boxsCount.length;i++){
                LODOP.ADD_PRINT_TEXT(30,10,71,20,"发货单号");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(30,80,115,20,data.headDetail.fbillno);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(6,197,213,35,data.headDetail.FCity);
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",20);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(49,15,45,40,"收货\r\n单位");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(49,64,298,40,data.headDetail.FReceive);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(88,15,45,40,"收货\r\n地址");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(88,62,300,40,data.headDetail.faddress);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(127,15,59,20,"联系人");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(127,79,163,20,data.headDetail.FContacts);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(147,15,46,19,"电话");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(147,75,280,20,data.headDetail.FMobile+"   "+data.headDetail.FTel);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(166,15,69,20,data.boxsCount[i]+"号箱");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(167,87,189,20,"冷藏物品请尽快派送");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(186,15,280,20,"日期");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(187,79,289,20,data.headDetail.FDate);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(206,15,50,35,"发货\r\n单位");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(214,73,278,20,"郑州安图生物工程股份有限公司");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                for(var j=0;j<data.bodyList.length;j++){
                   var body = data.bodyList[j];
                   LODOP.ADD_PRINT_TEXT(245+40*j,15,373,20,body.FEntryName);
                   LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                   LODOP.ADD_PRINT_TEXT(262+40*j,15,160,20,body.FEntryModel);
                   LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                   LODOP.ADD_PRINT_TEXT(262+40*j,175,105,20,body.FBatchNo);
                   LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                   LODOP.ADD_PRINT_TEXT(262+40*j,279,56,20,(body.FDoneNumber/data.boxsCount.length).toFixed(2));
                   LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
                   LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                   LODOP.ADD_PRINT_TEXT(262+40*j,335,76,20,body.FUnitName);
                   LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
              }
              LODOP.NewPage();
            }
             LODOP.PREVIEW();
        }else{
        LODOP.PRINT_INIT(data.headDetail.fbillno);
                console.log("=============后"+data.headDetail.fbillno);
                LODOP.ADD_PRINT_TEXT(30,10,71,20,"发货单号");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(30,80,115,20,data.headDetail.fbillno);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
//                LODOP.ADD_PRINT_TEXT(6,175,110,20,data.boxsCount[0]+"号箱");
////                LODOP.ADD_PRINT_TEXT(6,90,150,20,data.boxsCount[0]+"号箱");
//                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
//                                LODOP.SET_PRINT_STYLEA(0,"FontSize",20);
////                                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
//                                LODOP.SET_PRINT_STYLEA(0,"Bold",1);

                LODOP.ADD_PRINT_TEXT(6,200,160,35,data.headDetail.FCity);
                LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",20);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(49,15,45,40,"收货\r\n单位");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(49,64,298,40,data.headDetail.FReceive);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(88,15,45,40,"收货\r\n地址");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(88,62,300,40,data.headDetail.faddress);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(127,15,59,20,"联系人");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(127,79,163,20,data.headDetail.FContacts);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(147,15,46,19,"电话");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(147,75,280,20,data.headDetail.FMobile+"   "+data.headDetail.FTel);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(166,15,69,20,data.boxsCount[0]+"号箱");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(167,87,189,20,"冷藏物品请尽快派送");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(186,15,280,20,"日期");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(187,79,289,20,data.headDetail.FDate);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(206,15,50,35,"发货\r\n单位");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                LODOP.ADD_PRINT_TEXT(214,73,278,20,"郑州安图生物工程股份有限公司");
                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
                console.log(data.bodyList.length);
                var count = data.bodyList.length;
//                if(count <8){
//                     for(var i=0;i<data.bodyList.length;i++){
//                           var body = data.bodyList[i];
//                           LODOP.ADD_PRINT_TEXT(245+40*i,15,373,20,body.FEntryName);
//                           LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                           LODOP.ADD_PRINT_TEXT(262+40*i,15,160,20,body.FEntryModel);
//                           LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                           LODOP.ADD_PRINT_TEXT(262+40*i,175,105,20,body.FBatchNo);
//                           LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                           LODOP.ADD_PRINT_TEXT(262+40*i,279,56,20,body.FDoneNumber);
//                           LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
//                           LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                           LODOP.ADD_PRINT_TEXT(262+40*i,335,76,20,body.FUnitName);
//                           LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                     }
//                }else{
//                     for(var a=0;a<8;a++){
//                        var body = data.bodyList[a];
//                        LODOP.ADD_PRINT_TEXT(245+40*a,15,373,20,body.FEntryName);
//                        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                        LODOP.ADD_PRINT_TEXT(262+40*a,15,160,20,body.FEntryModel);
//                        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                        LODOP.ADD_PRINT_TEXT(262+40*a,175,105,20,body.FBatchNo);
//                        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                        LODOP.ADD_PRINT_TEXT(262+40*a,279,56,20,body.FDoneNumber);
//                        LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
//                        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                        LODOP.ADD_PRINT_TEXT(262+40*a,335,76,20,body.FUnitName);
//                        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                      }
//                      var pages = count-8;
//                      var totalPages = 1;
//                      if((pages % 13) == 0) {
//                          totalPages = parseInt(pages / 13);
//                      }else{
//                          totalPages = parseInt(pages / 13) + 1;
//                      }
//              for(var j=0;j<totalPages;j++){
//                LODOP.NewPage();
//                if(j==totalPages-1){
//                 LODOP.ADD_PRINT_TEXT(8,200,100,30,data.boxsCount[0]+"号箱");
//                 LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
//                 LODOP.SET_PRINT_STYLEA(0,"FontSize",15);
//                 LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
//                 LODOP.SET_PRINT_STYLEA(0,"Bold",1);
//                    var end = count - (totalPages-1)*13-8;
//                    for(var k=0;k<end;k++){
//                        var body1 = data.bodyList[8+k+j*13];
//                        LODOP.ADD_PRINT_TEXT(40+40*k,15,373,20,body1.FEntryName);
//                        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                        LODOP.ADD_PRINT_TEXT(57+40*k,15,160,20,body1.FEntryModel);
//                        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                        LODOP.ADD_PRINT_TEXT(57+40*k,175,105,20,body1.FBatchNo);
//                        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                        LODOP.ADD_PRINT_TEXT(57+40*k,279,56,20,body1.FDoneNumber);
//                        LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
//                        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                        LODOP.ADD_PRINT_TEXT(57+40*k,335,76,20,body1.FUnitName);
//                        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                    }
//                 }else{
//                        LODOP.ADD_PRINT_TEXT(8,200,100,30,data.headDetail.caseNum+"号箱");
//                             LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
//                             LODOP.SET_PRINT_STYLEA(0,"FontSize",15);
//                             LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
//                             LODOP.SET_PRINT_STYLEA(0,"Bold",1);
//                            for(var k=0;k<13;k++){
//                                var body1 = data.bodyList[8+k+j*13];
//                                LODOP.ADD_PRINT_TEXT(40+40*k,15,373,20,body1.FEntryName);
//                                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                                LODOP.ADD_PRINT_TEXT(57+40*k,15,160,20,body1.FEntryModel);
//                                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                                LODOP.ADD_PRINT_TEXT(57+40*k,175,105,20,body1.FBatchNo);
//                                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                                LODOP.ADD_PRINT_TEXT(57+40*k,279,56,20,body1.FDoneNumber);
//                                LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
//                                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                                LODOP.ADD_PRINT_TEXT(57+40*k,335,76,20,body1.FUnitName);
//                                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
//                            }
//                 }
//               }
//           }
          LODOP.SET_PRINT_MODE("CATCH_PRINT_STATUS",true);
          var enddf = LODOP.PREVIEW("_blank",350,560);
          window.MyBrowserAPI.get(enddf);
//          console.log("========================="+end1);
//          LODOP.PRINT();
        }
    }
    window.WarnPrint = WarnPrint;
})();
